
package game;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.io.File;
import java.io.IOException;

import system.*;

public class Splash extends Scene{

	Actor logo;
	AnimatedSprite logosprite;

	int timer = 0;

	public Splash(Game aGame, InputManager IM, SoundLibrary jukebox) {
		super(aGame, IM, jukebox);
		try {
			logosprite = new AnimatedSprite(new File("assets/sprites/splash.png"), 50, 8, false, 33);
		} catch (IOException e) {
			System.out.println("Cannot load AnimatedSprite assets");
		}
		logo = new Actor("logo", logosprite, 210F, 120F, 0F, 0F, 0, -1);



	}

	@Override
	public void paint(Graphics g){

		Graphics2D g2d = (Graphics2D)g;

		g2d.setColor(new Color(0,0,0));
		g2d.fillRect(0, 0, 480, 270);
		
		if (timer > 20 && timer < 75){
			if (timer == 33){
				jukebox.Play("coin.wav");
			}
			g2d.drawImage(logo.getImage(),logo.getX(),logo.getY(), getGame());
		} else if (timer > 90){
			game.setState(Game.GAME_START);			
		}
		
	}

	@Override
	public void update(){
		if (timer > 20){
			//logosprite.update();
			logo.update();
		}
		timer++;

	}
	
}
